            ReSource Disassembler's Keyboard Shortcuts

   ReSource's keyboard shortcuts save a lot of time.  They let
you activate any of your favorite functions in the menus (and
requesters) by pressing one to four keys, which is a lot faster
than mousing around, as long as you can remember which keys to
press.  I often forget, though, so I use a cheat sheet to remind
me.
   The default key bindings are listed in ShowKeys.doc, but a
printout of this file is useful only as a starting point.  After
you have changed or added some key bindings, you can print a
cheat sheet by CD-ing a Shell to the directory containing your
ShowKeys utility, and entering:  `ShowKeys >PRT:'.  This will
give you a printout listing the various key combinations on the
left, with their corresponding functions on the right, so that
you can easily look up any key combination and find the function
attached to it.  The data are arranged like this:

   ctl-3______________*/Convert specific EA's/Cvert W/base 3
   ctl-w______________SYMBOLS/Window
   ctl-t______________SYMBOLS/TrackDiskDevice cmds
   ctl-y______________*/DOS command

   Unfortunately, this is just the opposite of what you usually
want.  Normally, you have a function in mind, and need to look up
the key combination that will activate it.  The key combinations
on the left are systematically arranged, but the functions on the
right are in no discernible order.  You can scan through them
till you find the one you want, which works, but handy it is not.

>>> FormatRSKeys.rexx

   FormatRSKeys.rexx, the ARexx utility that comes with this
article, solves the problem.  It works with the unnumbered
version of ShowKeys that comes with ReSource V5.10, and also with
ShowKeys V3.01, which comes with ReSource V6.01, the latest
version.  Copy it to your Rexxc directory, CD a Shell to the
directory with your ShowKeys utility, and enter:  `rx
FormatRSKeys', which will create four files in RAM:.  ERSKeys
and SRFRSKeys are the ones you need.  The first contains the
normal output of ShowKeys, as described already, but with the
`ShowKeys' title line, and any blank lines, edited out.  The
second is a reformatted and sorted version of the first.  It
lists the functions on the left in sorted order, so that you can
look up any function quickly.  The corresponding key combination
is on the right.  You can print these files as they are, but I
prefer to do a little editing first.
   FormatRSKeys.rexx uses the C directory's Sort command to
sort the reformatted data from RFRSKeys to SRFRSKeys.  This is a
standard ASCII line sort, so the output is in ASCII sorted order,
but not always in logical order.  For instance, you will get:

   MACROS 1/Create/(#1)_________________________shift-kp1
   MACROS 1/Create/(#10)________________________shift-kp0
   MACROS 1/Create/(#11)________________________shiftctl-kp1
   MACROS 1/Create/(#12)________________________shiftctl-kp2
   MACROS 1/Create/(#2)_________________________shift-kp2

and

   SYMBOLS/Select field/First (default)_________1
   SYMBOLS/Select field/Fourth__________________4
   SYMBOLS/Select field/Second__________________2
   SYMBOLS/Select field/Third___________________3

   As I recall, I had to fix only three small areas.  You can
do it in a couple of minutes with a text editor.
   I also added a title and date to each file, and you may want
to add page numbers.
   I printed ERSKeys, with the data in the original order. 
Then I flipped the pages over and printed SRFRSKeys, the
reformatted and sorted version, on the other side.  If you do it
this way, you can just flip your cheat sheet over to use
whichever format you need.

>>> Canceling Key Assignments

   Once in a while, you may want to detach a key or key
combination from its assigned function.  I needed to do this
shortly after I got ReSource.  One of the first things I did was
to make a lot of macros, called `NewWindow', `NewScreen',
`Border', etc., then make a keyboard shortcut for each one.  That
lets me use the mouse, or a couple of keystrokes, to quickly
create the commonly used Amiga structures in a disassembly, and
avoid all that repetitive work.  Macros are one of ReSource's
best conveniences, and if you pass them by, you are really
missing something.  But given the right circumstances, they can
also be a real pain.
   Key combination/function assignments are held in a file
called RS.KeyTable, and the default file that comes with ReSource
has the `Repeat last command' function, from the (*)SPECIAL
FUNCTIONS menu, attached to the space bar.  This is the handiest
key to use with this function, and at first I saw no reason to
change it.  But one day, I tripped over the space bar while the
current line (or cursor line) was in the middle of one of my
beautiful structures.  In less than two seconds, it was ruined. 
As it happened, the last function I had used was a macro that
creates a structure, so ReSource tried to create a new structure
in the middle of the existing structure, which made an
unbelievable mess that took me several minutes to clean up.
   After that, I decided I had better remap the `Repeat last
command' function to some less accident-prone key combination.  I
chose <SHIFT>-<SPACE>, which is almost as handy, and a lot safer. 
That left the space bar still attached to the `Repeat last
command' function, however, so I still had to find a way to
cancel the key assignment.
   Replacing the function attached to a key combination is
easy.  First, select `Rebind key' from the (K)EY BINDINGS menu. 
Then, select a new function from a menu (both V5.10 & V6.01) or a
requester (V6.01 only).  Finally, type your key combination.
   Detaching a key or key combination from all functions is a
little different.  ReSource does not have a function that will
completely clear a key assignment.  You can attach an `empty'
macro slot to a key combination, and that will effectively cancel
the previously attached function, but if you ever put a macro
into that slot, your key combination will activate it.  A better
choice is to attach your key combination to a harmless function,
such as `About', in the (P)ROJECT menu.  If you inadvertently
activate this function, all it will do is put up a screenful of
information about ReSource, which you can erase with a mouse
click, and no harm done.  Since any function can have multiple
key assignments, you can attach `About' to all of the key
combinations you want to delete.
   The second method works well, but when you accidentally hit
the wrong key(s), it still surprises you by doing something you
did not expect.  I was dissatisfied with this, so I looked for a
better way.  As mentioned, key combination/function assignments
are held in RS.KeyTable, which is stored in the S directory, if
you are using ReSource V5.10, but which can also be in the
directory containing your ReSource load file, if you are using
V6.01, the latest version.  Examining this file, I found that its
2080 bytes are arranged as 10 groups of 104 words, or 208 bytes,
each.  The position of each of these words corresponds with one
key, or key combination.  Each word may or may not contain a
number corresponding with a ReSource function.  When the key or
key combination matching that word's position is pressed, the
corresponding function is executed.  If the word is null (hex
0000), the system beeps and flashes the screen, but nothing else
happens.
   It is obvious that to delete any keyboard shortcut, all you
have to do is overwrite the appropriate word with a null word. 
All that remains is to find the word.

>>> RS.KeyTable

   Each key has a Raw Key Code number assigned to it.  There
are two classes of keys - unmodified keys, and modifier keys. 
The <CTRL>, and left and right <SHIFT>, <ALT>, and <AMIGA> keys,
are modifier keys.  All the others, except for <CAPS LOCK>, which
is not used in this scheme, are unmodified keys.  RS.KeyTable is
organized as 10 groups of 104 words.  The position of each word
in a group corresponds with one possible key.  Since there are
only 94 keys on a standard American Amiga keyboard (86 unmodified
keys), some of these words are currently unassigned.
   The group is selected by pressing some combination of
modifier keys, as shown in this table:

                     RS.KeyTable

   1st 104 words                          Unmodified Keys
   2nd 104 words     Shift +              Unmodified Keys
   3rd 104 words     Alt +                Unmodified Keys
   4th 104 words     Shift + Alt +        Unmodified Keys
   5th 104 words     Ctrl +               Unmodified Keys
   6th 104 words     Shift + Ctrl +       Unmodified Keys
   7th 104 words     Alt + Ctrl +         Unmodified Keys
   8th 104 words     Shift + Alt + Ctrl + Unmodified Keys
   9th 104 words     Left Amiga +         Unmodified Keys
   10th 104 words    Right Amiga +        Unmodified Keys

>>> Raw Key Codes

   Each key has a corresponding Raw Key Code number, which
defines its position within each group.  For example, the
<ESCape> key's number is 69.  If you count off 69 words, or 138
bytes, from the start of each group, the next word will be one of
the 10 words in RS.KeyTable corresponding with the <ESCape> key. 
The key just under it, with the left single quote (`) character,
is number 0.  If you count off no words at all from the start of
each group, you will arrive at the initial word in the group,
which corresponds with this key.  The keys and their numbers are
shown below.  The modifier keys and the <CAPS LOCK> key each have
a Raw Key Code number also, but though each of them has a
position in each 104-word group in RS.KeyTable, a function number
is never assigned to any of these positions, since these keys
(except for <CAPS LOCK>) are used to select one of the 10 groups. 
Since these keys' Raw Key Code numbers are never used,  I have
left them out of the accompanying diagram for clarity.  If you
need them, you can find them printed in hex on page 59 of the
Amiga System Programmer's Guide, by Dittrich, Gelfand and
Schemmel, published by Abacus, 1988/89.

******************* T O   E D I T O R *******************
*                                                       *
*    I think the keyboard diagram(s) should be placed   *
*    nearby.  Look for diagram(s) at end of article.    *
*                                                       *
*********************************************************

   An Example:  To find the word in RS.KeyTable that matches
<Right Amiga>-<F10>, skip over the first 9 groups, and count off
89 words in the 10th group.  9 * 104 + 89 = 1025 words, or 2050
bytes.  Count off 2050 bytes, and the next word will be the one
you want.  Using a binary file editor, such as NewZAP, you can
delete the function assigned to this key combination by
overwriting the word with hex 0000.  Alternatively, you can
write in the hex number matching any function you want to assign
to these keys.

>>> ReSource Function Numbers

   The file, `ShowMacros.doc', contains a list of the ReSource
functions, with the decimal number assigned to each.  You will
need to convert these numbers to hexadecimal, if you want to
write them into RS.KeyTable using NewZAP.  You can do the job in
a jiffy with any base converter, such as a Hewlett-Packard-style
calculator program.  If you don't have one handy, you can convert
from decimal to hex, or from hex to decimal, just as well using
ARexx.  For example, enter into a Shell:

      rx "SAY D2X(31)"
or
      rx "SAY X2D(1F)"

   The `LABELS/Create single/Full-line comment' function is
#31, and the `MACROS 1/Execution speed/Fast' function is #411. 
To assign one of these functions to a key combination, you would
overwrite the appropriate word with hex 001F, or hex 019B.
   The `Repeat last command' function is number 367, or hex
16F.  For some reason, 367 is marked `reserved' in the version of
`ShowMacros.doc' that comes with ReSource V6.01, but is correctly
shown as `Repeat last command' in the file that comes with
ReSource V5.10.
   Using this info, you can locate the word in RS.KeyTable that
corresponds with any key combination, which will let you detach a
function from it, or attach any function to it.  But if you only
want to detach a function from one or more key combinations, you
may find it faster to just convert the decimal number
corresponding with the function to hex, and use NewZAP to search
for the hex word in RS.KeyTable.  To find each word that matches
the `Repeat last command' function, for instance, you would enter
`$016F', without the quotes, into the NewZAP search string
requester.
   If you don't have a binary file editor on hand, you can
patch RS.KeyTable with ReSource itself.  Select `Open binary
file' from the (P)ROJECT menu, and load RS.KeyTable.  Set the
data type to words (<LEFT AMIGA>-w), switch on `Offsets' and
`Leading zeros' in the (O)PTIONS 1 requester (V6.01) or menu
(V5.10), and use ZAP2 (or ZAP) from the (*)SPECIAL FUNCTIONS menu
to overwrite words with the values you want.  Once again, you can
find the words you need either by calculating their positions, or
by using the Search function.

>>> Improving RS.KeyTable

   The first commercial version of ReSource I got was V5.10. 
When I upgraded to V6.01, I did not get a new manual, so
apparently The Puzzle Factory is still using the old manual with
the new version.  The manual is very slim, and though it is
useful, it could be improved by adding many more disassembly
tutorials.
   It also contains a few errors.  For instance, the manual
claims that kp9 (the `9' key on the numerical keypad) activates
the `LABELS/Create single/Label' function, which is normally
attached to kp*.  In the default RS.KeyTable file that came with
ReSource V5.10, kp9 was actually attached to `MACROS
1/Execute/(#9)'.  To prevent users from being confused by the
error in the manual, kp9 was reassigned to `LABELS/Create
single/Label' in the RS.KeyTable file that comes with ReSource
V6.01, so that both kp9 and kp* are attached to the same
function.  For consistency, <SHIFT>-kp9 was moved from `MACROS
1/Create/(#9)' to `LABELS/Edit single/Label'.  <SHIFT>-kpenter is
attached to the same function.  Since the key assignments for
both `LABELS/Create single/Label' and `LABELS/Edit single/Label'
are duplicated, I moved kp9 and <SHIFT>-kp9 back to `MACROS
1/Execute/(#9)' and `MACROS 1/Create/(#9)', which have no keys
assigned to them in the new default RS.KeyTable file.  I also
changed `LABELS/Edit single/Label' from <SHIFT>-kpenter back to
<SHIFT>-kp*, as it was in the V5.10 default RS.KeyTable.
   Many of the keyboard shortcuts in the V5.10 RS.KeyTable were
pruned from the V6.01 RS.KeyTable, and others were changed.  Some
of the changes were not well thought out, IMHO, and you will
probably find a few that you will want to change back, yourself;
or you may prefer to edit the RS.KeyTable file that you used with
a previous release of ReSource.  I hope that this article has
made the job a little easier for you.

************************************************************

************************* T O   E D I T O R *************************
*                                                                   *
*  Use diagram below if you can print this width.  Otherwise, use   *
*  following two diagrams.  This diagram, and the main keyboard     *
*  diagram below, are both too wide for me to print, but should     *
*  print easily within the full width of a magazine page.           *
*                                                                   *
*********************************************************************


                          Raw Key Codes


______   _______ _______ _______ _______ _______  _______ _______ _______ _______ _______
|Esc |   |F1   | |F2   | |F3   | |F4   | |F5   |  |F6   | |F7   | |F8   | |F9   | |F10  |
| 69 |   | 80  | | 81  | | 82  | | 83  | | 84  |  | 85  | | 86  | | 87  | | 88  | | 89  |
|----|   |-----| |-----| |-----| |-----| |-----|  |-----| |-----| |-----| |-----| |-----|

_________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____   ________ ________   _____ _____ _____ _____
|~      | |!1 | |@2 | |#3 | |$4 | |%5 | |^6 | |&7 | |*8 | |(9 | |)0 | |_- | |+= | ||\ | |Bk |   |Del   | |Help  |   |(  | |)  | |/  | |*  |
|`   0  | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10| | 11| | 12| | 13| | 65|   |  70  | |  95  |   | 90| | 91| | 92| | 93|
|-------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---|   |------| |------|   |---| |---| |---| |---|
___________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _________                       _____ _____ _____ _____
| Tab     | |Q  | |W  | |E  | |R  | |T  | |Y  | |U  | |I  | |O  | |P  | |{[ | |}] | |       |                       |7  | |8  | |9  | |-  |
|     66  | | 16| | 17| | 18| | 19| | 20| | 21| | 22| | 23| | 24| | 25| | 26| | 27| |       |                       | 61| | 62| | 63| | 74|
|---------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |       |                       |---| |---| |---| |---|
______ ______ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ ____|       |         _____         _____ _____ _____ _____
|Ctrl| |Caps| |A  | |S  | |D  | |F  | |G  | |H  | |J  | |K  | |L  | |:; | |"' | | Return    |         |Up |         |4  | |5  | |6  | |+  |
|    | |Lock| | 32| | 33| | 34| | 35| | 36| | 37| | 38| | 39| | 40| | 41| | 42| |    68     |         | 76|         | 45| | 46| | 47| | 94|
|----| |----| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |-----------|         |---|         |---| |---| |---| |---|
_______________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _______________     _____ _____ _____   _____ _____ _____ _____
| Shift       | |Z  | |X  | |C  | |V  | |B  | |N  | |M  | |<, | |>. | |?/ | | Shift       |     |Lf | |Dn | |Rt |   |1  | |2  | |3  | |E  |
|             | | 49| | 50| | 51| | 52| | 53| | 54| | 55| | 56| | 57| | 58| |             |     | 79| | 77| | 78|   | 29| | 30| | 31| |n  |
|-------------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |-------------|     |---| |---| |---|   |---| |---| |---| |t  |
      ______ _____ _____________________________________________________ _____ ______                               ___________ _____ |e  |
      |Alt | |A  | |                                                   | |A  | |Alt |                               |0        | |.  | |r  |
      |    | |   | |                        64                         | |   | |    |                               | 15      | | 60| | 67|
      |----| |---| |---------------------------------------------------| |---| |----|                               |---------| |---| |---|




************************* T O   E D I T O R *************************
*                                                                   *
*   Use following two diagrams if one above is too wide to print.   *
*                                                                   *
*********************************************************************



                          Raw Key Codes

  
______   _______ _______ _______ _______ _______  _______ _______ _______ _______ _______ 
|Esc |   |F1   | |F2   | |F3   | |F4   | |F5   |  |F6   | |F7   | |F8   | |F9   | |F10  |
| 69 |   | 80  | | 81  | | 82  | | 83  | | 84  |  | 85  | | 86  | | 87  | | 88  | | 89  |
|----|   |-----| |-----| |-----| |-----| |-----|  |-----| |-----| |-----| |-----| |-----|
                                                                                             
_________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
|~      | |!1 | |@2 | |#3 | |$4 | |%5 | |^6 | |&7 | |*8 | |(9 | |)0 | |_- | |+= | ||\ | |Bk |
|`   0  | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10| | 11| | 12| | 13| | 65|
|-------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---|
___________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _________
| Tab     | |Q  | |W  | |E  | |R  | |T  | |Y  | |U  | |I  | |O  | |P  | |{[ | |}] | |       |
|     66  | | 16| | 17| | 18| | 19| | 20| | 21| | 22| | 23| | 24| | 25| | 26| | 27| |       |
|---------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |       |
______ ______ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ ____|       |
|Ctrl| |Caps| |A  | |S  | |D  | |F  | |G  | |H  | |J  | |K  | |L  | |:; | |"' | | Return    |
|    | |Lock| | 32| | 33| | 34| | 35| | 36| | 37| | 38| | 39| | 40| | 41| | 42| |    68     |
|----| |----| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |-----------|
_______________ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _______________  
| Shift       | |Z  | |X  | |C  | |V  | |B  | |N  | |M  | |<, | |>. | |?/ | | Shift       |  
|             | | 49| | 50| | 51| | 52| | 53| | 54| | 55| | 56| | 57| | 58| |             |  
|-------------| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |-------------|  
      ______ _____ _____________________________________________________ _____ ______        
      |Alt | |A  | |                                                   | |A  | |Alt |        
      |    | |   | |                        64                         | |   | |    |        
      |----| |---| |---------------------------------------------------| |---| |----|        



 ________ ________   _____ _____ _____ _____                                               
 |Del   | |Help  |   |(  | |)  | |/  | |*  |
 |  70  | |  95  |   | 90| | 91| | 92| | 93|
 |------| |------|   |---| |---| |---| |---|
                     _____ _____ _____ _____
                     |7  | |8  | |9  | |-  |
                     | 61| | 62| | 63| | 74|
                     |---| |---| |---| |---|
       _____         _____ _____ _____ _____
       |Up |         |4  | |5  | |6  | |+  |
       | 76|         | 45| | 46| | 47| | 94|
       |---|         |---| |---| |---| |---|
 _____ _____ _____   _____ _____ _____ _____
 |Lf | |Dn | |Rt |   |1  | |2  | |3  | |E  |
 | 79| | 77| | 78|   | 29| | 30| | 31| |n  |
 |---| |---| |---|   |---| |---| |---| |t  |
                     ___________ _____ |e  |
                     |0        | |.  | |r  |
                     | 15      | | 60| | 67|
                     |---------| |---| |---|
